cmake_minimum_required(VERSION 3.10)

cmake_policy(SET CMP0074 NEW)
find_package(Boost COMPONENTS date_time)

include_directories(${Boost_INCLUDE_DIRS})

set(SRC src/db.cpp src/resultset.cpp src/db_factory.cpp src/db_sqlite.cpp src/resultset_sqlite.cpp)

if(NOT DEFINED ENV{NO_MYSQL})
    set(SRC ${SRC} src/db_mysql.cpp src/resultset_mysql.cpp)
endif()

if(NOT DEFINED ENV{NO_POSTGRESQL})
    set(SRC ${SRC} src/db_pg.cpp src/resultset_pg.cpp)
endif()

add_library(osdb SHARED ${SRC})

DB_SELECT(osdb)

target_link_libraries(osdb oslog env)
set_target_properties(osdb PROPERTIES WIN32_MANIFEST "NO")

install(TARGETS osdb LIBRARY)